<?php
/*
  $Id: search.php $
  TomatoCart Open Source Shopping Cart Solutions
  http://www.tomatocart.com

  Copyright (c) 2009 Wuxi Elootec Technology Co., Ltd;  Copyright (c) 2006 osCommerce

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License v2 (1991)
  as published by the Free Software Foundation.
*/

class toC_Security {
  /* Filter the input data*/
  function filter_input() {
    $_GET = $this->xss_clean($_GET);
    $_POST = $this->xss_clean($_POST);
    $_REQUEST = $this->xss_clean($_REQUEST);
  }
  
   /* Xss Clean  */
  function xss_clean($data) {
    if (is_array($data)) {
        foreach ($data as $key => $value) {
        unset($data[$key]);
        
          $data[$this->xss_clean($key)] = $this->xss_clean($value);
        }
    } else { 
        $data = htmlspecialchars($data, ENT_COMPAT);
    }

    return $data;
  }
}
?>